package com.zty.xiaomiadmin.server.Controller;

import com.zty.xiaomiadmin.server.Entity.Result;
import com.zty.xiaomiadmin.server.Service.IndexService.IndexService;
import com.zty.xiaomiadmin.server.Service.IndexService.IndexServiceImpl;
import com.zty.xiaomiadmin.server.Service.User.UserServiceImp;
import com.zty.xiaomiadmin.server.Vo.User.UserData;
import com.zty.xiaomiadmin.server.Vo.User.UserResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("index")
public class IndexController {

    @Autowired
    private IndexService indexService;

    @RequestMapping("/getNumber")
    public Result getNumber() throws IOException {
        Map<String, Object> map = indexService.getIndexData();
        return new Result(200, "获取首页number成功", map);
    }

    @RequestMapping("/getStoreIdByName")
    public Result getStoreIdByName(String name) throws IOException {
        System.out.println(name);
        Map<String, Object> map = indexService.getStoreIdByName(name);
        return new Result(200, "根据name获取用户ID成功", map);
    }
}
